package com.bw.services.visit.model

import android.util.Log
import com.bw.common.http.NetUtils.httpRequest
import com.bw.services.visit.VisitApiService
import com.bw.services.visit.entity.VisitData
import javax.inject.Inject

class VisitRepo @Inject constructor(private val apiService: VisitApiService){
    suspend fun getVisit():List<VisitData>?{
        return try {
            val result =httpRequest {apiService.getVisit()}
            if (result.code == 200){
                Log.d("TAG", "getVisit: 成功")
                result.data
            }else{
                Log.d("TAG", "getVisit: 失败1")
                null
            }
        } catch (e: Exception){
            Log.d("TAG", "getVisit:${e.message}")
            null
        }
    }
}